//
// Created by sjjmw on 3/24/2022.
//
#include "iostream"
#include "vector"
#include "list"
#include "algorithm"

//判断行的奇偶即可
void handle(int n){
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(i%2==0){
                printf("%4d",i*n+j+1);
            }else{
                printf("%4d",i*n+n-(j));
            }
        }
        printf("\n");
    }
}

int main(){
    int a,b;
    while(std::cin>>a){
        handle(a);
    }
    return 0;
}